package com.qf.homework.service.impl;

import com.qf.homework.dao.BookDao;
import com.qf.homework.entity.Book;
import com.qf.homework.service.BookServ;
import com.qf.homework.util.Batis01Util;
import com.qf.homework.util.MyCache;

public class BookServiceImpl implements BookServ {
    //检查本地缓存是否保存了 对应数据
    //如果没有 再去查询数据库
    //如果有则返回数据
    public static final  String prfix = "book";
    @Override
    public Book getBook(Integer id) {
        String key = prfix +":"+id;
        Book book = (Book)MyCache.cache.get(key);
        if (book!=null){
            return book;
        }
        BookDao mapper = Batis01Util.getMapper(BookDao.class);

        return null;
    }
}
